﻿Public Class Register
    Inherits CoreClass


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub


    Private Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
        Try
            
            sql = "spo_CusInsert "
            sql &= objFunction.FieldCheck(txtUsername.Text) & ","
            sql &= objFunction.FieldCheck(txtPassword.Text) & ","
            sql &= objFunction.FieldCheck(txtEmail.Text) & ","
            sql &= objFunction.FieldCheck(txtPhone.Text) & ","
            sql &= objFunction.FieldUniCk(txtName.Text) & ","
            sql &= objFunction.FieldUniCk(txtAddress.Text) & ","
            sql &= objFunction.FieldCheck("") & ","
            sql &= objFunction.FieldCheck(txtIDCard.Text)
            objDataRead.ExeReader(sql)
            If objDataRead.dataRead.Read Then
                If Integer.Parse(objDataRead.dataRead("CusID").ToString()) = 0 Then
                    objAlert.ErrorBox(Page, "Tài khoản này đã tồn tại trong hệ thống, hãy chọn tài khoản khác.")
                Else
                    objAlert.InfoBox(Page, "Bạn đã đăng ký thành công", "/")
                End If
            End If

        Catch ex As Exception
            If objConfig.Developer.Equals("1") Then
                objAlert.ErrorBox(Page, "File: " & (New System.Diagnostics.StackTrace).GetFrame(0).GetMethod.DeclaringType.Name & _
                                  " --- Function: " & (New System.Diagnostics.StackTrace).GetFrame(0).GetMethod.Name & _
                                  " --- Mess: " & ex.Message.Replace("'", """"))
            Else
                objAlert.ErrorBox(Page, "Lỗi kỹ thuật, hãy thông báo lại với Admin, xin cảm ơn.")
            End If
        End Try
    End Sub


End Class